/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package project.jpdftools.ui.actionlisteners;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.logging.Level;
import project.jpdftools.managers.LoggerManager;
import project.jpdftools.ui.managers.IconManager;
import project.jpdftools.managers.other.FileUtil;

/**
 *
 * @author Mido
 */
public class ApplyIconAction implements ActionListener {

    private String icon_name;  // name of the folder containing all the icons

    /**
     * Constructor with parameters
     *
     * @param icon_name selected icon name(containing folder name)
     */
    public ApplyIconAction(String icon_name) {
        this.icon_name = icon_name;
    }

    /**
     * The action that will be performed by this action listener
     *
     * @param e
     */
    public void actionPerformed(ActionEvent e) {
        // apply images
        IconManager.applyIcons(icon_name);
        // save folder name
        new FileUtil().writeToFile("Data/icon.txt", icon_name, false, false);
        LoggerManager.getLogger().log(Level.INFO, "Icons changed to \"{0}\"", icon_name);
    }
}
